#!/bin/bash
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This is for bash on NaCl. Note that you cannot use external commands
# until the installation is completed. Also, you cannot use features
# which nacl_io does not support yet (e.g., pipes and sub-shells).

# Setup environment once to get location of fixed things like coreutils.
source /mnt/http/setup-environment

# Core packages.
DEFAULT_PACKAGES="\
  -i coreutils \
  -i curl \
  -i git \
  -i make \
  -i nano \
  -i python \
  -i vim"

if [ "${NACL_ARCH}" != "arm" ]; then
  DEFAULT_PACKAGES+=" \
-i mingn.base \
-i mingn.lib"
fi

# Check for updates on some packages.
package ${DEFAULT_PACKAGES[@]}

if [ "${NACL_ARCH}" == "arm" ]; then
  echo "WARNING: gcc not yet available on arm (coming soon)." 2>&1
  echo "WARNING: git currently broken on arm." 2>&1
fi

# Setup environment again, to rescan the packages added.
source /mnt/http/setup-environment

cd ${HOME}

if [ -e ${HOME}/.bashrc ]; then
  source ${HOME}/.bashrc
fi
